package com.spirit.mypopup;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class Main3Activity extends AppCompatActivity {
    private static final String TAG = "Main3Activity";
    private MyMenuFilterView menuFilterView;
    private MyMenuFilterView filterView2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);

        menuFilterView = findViewById(R.id.filterView);
        filterView2 = findViewById(R.id.filterView2);

        List<String> strings = new ArrayList<>();
        strings.add("android");
        strings.add("java");
        strings.add("javascript");
        strings.add("android");
        strings.add("java");
        strings.add("javascript");
        strings.add("android");
        strings.add("java");
        strings.add("javascript");
        strings.add("android");
        strings.add("java");
        strings.add("javascript");


        List<String> strings2 = new ArrayList<>();
        strings2.add("aa");
        strings2.add("vv");
        strings2.add("bb");


        List<String> strings3 = new ArrayList<>();
        strings3.add("a");
        strings3.add("v");
        strings3.add("n");

        final Map<String, List<String>> map = new LinkedHashMap<>();
        map.put("努力", strings);
        map.put("奋斗", strings2);
        map.put("加油", strings3);


        menuFilterView.post(new Runnable() {
            @Override
            public void run() {
                menuFilterView.setData(map);
            }
        });

        /*filterView2.post(new Runnable() {
            @Override
            public void run() {
                filterView2.setData(map);
            }
        });*/


        menuFilterView.setClickListener(new OnMyItemClickListener() {
            @Override
            public void OnMyItemClick(String mag) {
                Log.i(TAG, "OnMyItemClick: " + mag);
            }
        });
        filterView2.setClickListener(new OnMyItemClickListener() {
            @Override
            public void OnMyItemClick(String mag) {
                Log.i(TAG, "OnMyItemClick: filterView2=" + mag);
            }
        });

    }

}
